package com.viviet.mobileservices.web.action;

import com.opensymphony.xwork2.ModelDriven;
import com.viviet.mobileservices.common.BaseAction;
import com.viviet.mobileservices.domain.info.MessageInfo;
import com.viviet.mobileservices.domain.model.CustomerModel;
import com.viviet.mobileservices.util.Utilities;

public class UserAction extends BaseAction implements
		ModelDriven<CustomerModel> {
	private static final long serialVersionUID = -4606720304727321826L;
	private CustomerModel model = new CustomerModel();
	private MessageInfo msg;

	public CustomerModel getModel() {
		return this.model;
	}

	public String logined() {
		setMsg(createMessage(0, "LG001", "msg.logined_success"));
		model.setVivietAcc(Utilities.getWebUserDetails().getUser().getCustomerId());
		return "success";
	}

	public String accessDenied() {
		setMsg(createMessage(1, "CM002", "msg.error.user_access.denied"));

		return "success";
	}

	public String loginFailed() {
		setMsg(createMessage(1, "LG002", "msg.error.login_failed"));
		return "success";
	}

	public String duplicatedLogin() {
		setMsg(createMessage(1, "LG005", "msg.error.duplicate_login"));

		return "success";
	}

	public MessageInfo getMsg() {
		return this.msg;
	}

	public void setMsg(MessageInfo msg) {
		this.msg = msg;
	}
}